package com.df.datacloud.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.web.ErrorController;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by junlee on 2017/10/23.
 */
@RestController
@RequestMapping("/error")
public class GlobalErrorController implements ErrorController {
	
	public final static Logger logger = LoggerFactory.getLogger(GlobalErrorController.class);
	/**
	 * 出异常后进入该方法，交由下面的方法处理
	 */
	@Override
	public String getErrorPath() {
		return "/error";
	}
	
	@RequestMapping("/error")
	public String error() {
		logger.error("出现异常");
		return "出现异常";
	}
}